-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support a more generic ipxe installer #192
support a more generic ipxe installer #192
Conversation
Codecov Report
@@ Coverage Diff @@
## master #192 +/- ##
==========================================
+ Coverage 41.38% 41.94% +0.56%
==========================================
Files 41 41
Lines 2576 2620 +44
==========================================
+ Hits 1066 1099 +33
- Misses 1423 1436 +13
+ Partials 87 85 -2
Continue to review full report at Codecov.
|
Hey @mikemrm, I'm not seeing how this is different than the existing Also, I've put out a proposal that includes deprecating all installers besides a default. I believe there has been an unofficial desire amongst the community to deprecate all installers too. |
Correct @jacobweinstock however this differs in how it is triggered. The The trouble is that this process is only triggered due to the distro being This change makes this path more direct by not relying on faking / overriding a field. |
I agree with that desire and I believe this functionality would allow us to remove the other installers leaving only this method. |
@mikemrm , there are actually 2 fields that can trigger a Boots Installer. If I understand the use-case correctly, then the |
Correct, it does appear custom_ipxe is actually only being registered for a slug. Meaning slug is the field that would need to be set. This however doesn't change the issue, as slugs are typically understood as a unique string. Which in this case is the Operating System Version slug which an OS may have many OSVs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chaining and script can both be done with custom_ipxe, why do we need this instead of custom_ipxe?
well I should refresh before commenting it seems |
@mikemrm and I talked offline. (@mikemrm correct me if I misspeak here at all!) Here's the synopsis. There is a desire to add an additional hardware data field |
b895f56
to
19bd269
Compare
Do we really need support for both |
Script was included to make it easier to push an exact script rather than relying on an externally hosted one. This is just a beneficial addition I can see useful for many things including testing without relying on external services. |
I think it's important to note the following. This functionality can already be accomplished via the existing |
2216b3d
to
2c9cfa4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for being open to change so much!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a DCO issue to address and this should be good to go!
4e05bd2
to
cefd35e
Compare
Right, so why don't we just support only |
Besides the fact that it supports the two code paths of the original custom_ipxe method. I think it also makes an easy way to do the chain loading and adds minimal code. However if you feel this cannot be, I can remove. |
Yeah I think this makes sense, it also makes explicit what was implicit before (either you feed in an |
cefd35e
to
0d7fb58
Compare
installers/custom_ipxe/main.go
Outdated
logger := installers.Logger("custom_ipxe") | ||
if j.InstanceID() != "" { | ||
logger = logger.With("instance.id", j.InstanceID()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the job should have its own logger already with these fields (and more) already populated, so this should just be:
logger := job.logger.With("installer", "custom_ipxe")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. updating
installers/custom_ipxe/main.go
Outdated
func bootScript(j job.Job, s *ipxe.Script) { | ||
func ipxeScript(j job.Job, s *ipxe.Script) { | ||
logger := installers.Logger("custom_ipxe") | ||
if j.InstanceID() != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm we should probably return a s.Shell if there's no instance id right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point, will update.
installers/custom_ipxe/main.go
Outdated
if cfg == nil { | ||
s.Echo("Installer data not provided") | ||
s.Shell() | ||
logger.Error(err, "empty installer data") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err is currently nil here, actually this looks like the only use of err
at all so no need for var err error
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, with all the changes this is no longer needed.
Signed-off-by: Mike Mason <mason@packet.com>
Signed-off-by: Mike Mason <mason@packet.com>
Signed-off-by: Mike Mason <mason@packet.com>
Signed-off-by: Mike Mason <mason@packet.com>
Signed-off-by: Mike Mason <mason@packet.com>
Signed-off-by: Mike Mason <mason@packet.com>
Signed-off-by: Mike Mason <mason@packet.com>
48fdcab
to
1f966ce
Compare
That is an interesting idea @displague however I'm not sure how common it is for someone to want to data uri encode a script and would be interested to see others thoughts about supporting it. |
I imagine users are not writing templates by hand and would use CLIs and APIs to get the value in place. We have a URL field and data URLs are an established pattern for providing any data as a URL. Rather than fetch the resource over HTTP, ftp, nntp, gopher, we have the data contained in the URL and the field can be said to support HTTP, HTTPS, and data URLs. Existing APIs and CLIs that wrap the Tinkerbell API and pass the IPXE URL to Tinkerbell will get this functionality for free (they won't need to be updated for a changed Tinkerbell spec). |
} else if j.IPXEScriptURL() != "" { | ||
cfg = &packet.InstallerData{Chain: j.IPXEScriptURL()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To illustrate how we could benefit from Data URL handling (using https://pkg.go.dev/github.com/vincent-petithory/dataurl#example-DecodeString):
} else if dataURL, err := dataurl.DecodeString(j.IPXEScriptURL()); err == nil {
// I assume err is returned unless there is a real data URL, but we might need different logic to ensure the URL was actually a data URL and not just empty
cfg = &packet.InstallerData{Script: dataURL.Data}
} else if j.IPXEScriptURL() != "" {
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@displague lets give it a go in a different PR.
Description
Allows more generic support for ipxe installers for installation of an OS which cannot be modified to work with the OSIE installation method.
The new ipxe installer works similar to custom_ipxe however differs in that it is selected earlier in the process for different handling of data and which is used for any os which has the installer set to
ipxe
.Why is this needed
Some os installation processes have unique installation environments which do not lend themselves easily to osie liveos / workflow setup as seen with other installers in boots like vmware and coreos. However instead of hard coding a new OS into boots, this method allows for those dynamic configurations to be handled separately by allowing the installer to be set to ipxe which supports chaining or injecting a script to boot the installer.
The model has changed for
packet.OperatingSystem
to now have two additional optional fieldsInstaller
andInstallerData
.The ipxe installer is configurable through the
InstallerData
field which it expects to be a string encoded JSON blob of which two fields may be specifiedchain
which should be a full URL to a valid iPXE script andscript
which allows for injecting an ipxe script directly.Example of both configurable fields:
Example using iPXE installer with chain loading:
How are existing users impacted? What migration steps/scripts do we need?
No changes to existing functionality, only adding additional support.